import { IPSSysBDScheme } from '../../ba/ipssys-bdscheme';
import { IPSSysBDTable } from '../../ba/ipssys-bdtable';
import { IPSDEBDTable } from './ipsdebdtable';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEBDTableImpl extends PSModelObjectImpl implements IPSDEBDTable {
  get bDTableDEType(): 1 | 2 | 3 | 0 {
    return this.M.bDTableDEType;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssysbdscheme: IPSSysBDScheme | null = null;

  getPSSysBDScheme(): IPSSysBDScheme | null {
    if (this.pssysbdscheme != null) return this.pssysbdscheme;
    const value = this.M.getPSSysBDScheme;
    if (value == null) {
      return null;
    }
    this.pssysbdscheme = this.getPSModel4('ba.IPSSysBDScheme', value, 'getPSSysBDScheme') as IPSSysBDScheme;
    return this.pssysbdscheme;
  }

  get psSysBDScheme(): IPSSysBDScheme | null {
    return this.getPSSysBDScheme();
  }

  getPSSysBDSchemeMust(): IPSSysBDScheme {
    const value = this.getPSSysBDScheme();
    if (value == null) {
      throw new Error('未指定大数据体系');
    }
    return value;
  }

  protected pssysbdtable: IPSSysBDTable | null = null;

  getPSSysBDTable(): IPSSysBDTable | null {
    if (this.pssysbdtable != null) return this.pssysbdtable;
    const value = this.M.getPSSysBDTable;
    if (value == null) {
      return null;
    }
    const ipssysbdscheme = this.getPSSysBDScheme();
    if (ipssysbdscheme != null) {
      this.pssysbdtable = ipssysbdscheme.findPSSysBDTable(value);
    }
    return this.pssysbdtable;
  }

  get psSysBDTable(): IPSSysBDTable | null {
    return this.getPSSysBDTable();
  }

  getPSSysBDTableMust(): IPSSysBDTable {
    const value = this.getPSSysBDTable();
    if (value == null) {
      throw new Error('未指定大数据表');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSDEBDTableImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.ba.IPSDEBDTable') return true;
    return super.instanceof(cls);
  }
}
